IdeaBlade.EntityModel.Compat Assembly > IdeaBlade.EntityModel.Compat Namespace > EntityScalarQueryAsyncExtensions Class > Average Method : Average<TSource>(IEntityScalarQuery<TSource>,Action<EntityScalarQueryOperation<TSource>>,Object) Method |
'Declaration
<ExtensionAttribute()> Public Overloads Shared Function Average(Of TSource)( _ ByVal source As IEntityScalarQuery(Of TSource), _ ByVal userCallback As Action(Of EntityScalarQueryOperation(Of TSource)), _ Optional ByVal userState As Object _ ) As EntityScalarQueryOperation(Of TSource)
'Usage
Dim source As IEntityScalarQuery(Of TSource) Dim userCallback As Action(Of EntityScalarQueryOperation(Of TSource)) Dim userState As Object Dim value As EntityScalarQueryOperation(Of TSource) value = EntityScalarQueryAsyncExtensions.Average(Of TSource)(source, userCallback, userState)
[Extension()] public static EntityScalarQueryOperation<TSource> Average<TSource>( IEntityScalarQuery<TSource> source, Action<EntityScalarQueryOperation<TSource>> userCallback, object userState )
public void AsyncAverage() { var op = _entityManager.OrderSummaries.Select(o => o.Freight).AsScalarAsync().Average(); op.Completed += (o, e) => { var ct = e.Result; }; }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2